<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>Audio auto play in mobile</title>
    <script src="jquery-1.10.2.min.js"></script>
</head>
<body>
<audio preload="preload" id="car_audio" src="wav/bgm.wav" loop=""></audio>
<script>
    setTimeout(function(){
        $(window).scrollTop(1);
    },0);

    /*音乐*/
    var audio = $('#car_audio');
    var isPlaying = false;
    function playAudio() {
        var audio = $('#car_audio');
        if (audio.attr('src') == undefined) {
            audio.attr('src', audio.data('src'));
        }
        audio[0].play();
        isPlaying = true;
    }
    $(function(){
        playAudio();
        document.addEventListener("WeixinJSBridgeReady", function () {
            WeixinJSBridge.invoke('getNetworkType', {}, function (e) {
                network = e.err_msg.split(":")[1];  //结果在这里
                playAudio();
            });
        }, false);
    })
</script>
</body>
</html>